using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Collections.Generic;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.IO;
using MCWEBSITE.BUL;
using MCWEBSITE.ENTITY;

public partial class Modules_WebsiteFrontSub_wucNewsList : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            this.FillData();
        }
    }

    protected void FillData()
    {
        string Language = "vi-VN";
        try
        {
            Language = Session["LanguageCode"].ToString();
        }
        catch (Exception ex)
        {
            throw ex;
        }
        DataSet lstwebsiteNewsInfo = new DataSet();
        lstwebsiteNewsInfo = websiteNewsBUL.SelectNtoMByLanguage(1, 1000, Language);
        PagedDataSource PagingController = new PagedDataSource();
        PagingController.DataSource = lstwebsiteNewsInfo.Tables[0].DefaultView;
        PagingController.AllowPaging = true;
        PagingController.PageSize = PagingObject.PageSize;
        PagingController.CurrentPageIndex = PagingObject.CurrentPage - 1;
        PagingObject.TotalPage = PagingController.PageCount;
        PagingObject.TotalRecord = lstwebsiteNewsInfo.Tables[0].Rows.Count;
        PagingObject.ReBindPaging();
        dlNewsList.DataSource = PagingController;
        dlNewsList.DataBind();
    }

    protected void PagingObject_PageSelectedIndexChanged(object sender, PageSelectedIndexChange e)
    {
        PagingObject.CurrentPage = e.SelectedPageIndex;
        this.FillData();
    }
}
